<template>
	<view class="warn-container">
		<view class="topDetail">
			<view class="l">
				<image src="../../static/warn-AI.png" mode=""></image>
				<view class="text">
				</view>
				<view class="button" style="border: none;">
				</view>
			</view>
		</view>
		<view class="warn-main" v-if="warnList.length">
			<view class="info">设备异常项检测</view>
			<view class="warn-item" v-for="(item,index) in warnList" :key="index">
				<view class="module color-title">
					<u-icon name="info-circle" color="#5990FF" size="18"></u-icon>
					<text>{{item.module}}</text>
				</view>
				<view class="title color-title">
					<view class="left">{{item.item}}</view>
					<view class="right" v-if="item.times">
						<u-icon name="warning-fill" color="#55aaff" size="18"></u-icon>
						<text style="color: #55aaff;">x{{item.times}}</text>
					</view>
				</view>
				<view class="title-text color-title-text">{{item.msg}}</view>
				<view class="content color-content">
					<!-- <text class="" v-html="item.recommend" style="word-break:break-all;"></text> -->
				</view>
			</view>
		</view>
		<view class="" style="margin-top: 100rpx;" v-else>
			<u-empty mode="data"></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				warnList: []
			};
		},
		onLoad(options) {
			this.warnInfo(options.sn)
		},
		methods: {
			async warnInfo(sn) {
				const params = {
					sn
				}
				const res = await this.$fun.ajax.post('butt/deviceAlarmInfo', params)
				if (res.code === 1) {
					// res.data.forEach(i=>{
					// 	i.recommend = i.recommend.replace(/\n/g,'<br>')
					// })
					this.warnList = res.data
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #EEEEEE;
	}

	.color-title {
		color: #5990FF;
	}

	.color-title-text {
		color: #999;
	}

	.color-content {
		color: #3aa74a;
	}

	.warn-container {
		.topDetail {
			width: 100%;
			background: #00aaff;
			display: flex;
			padding: 30rpx;
			padding-bottom: 60rpx;

			.l {
				width: 100%;
				text-align: center;

				image {
					width: 200rpx;
					height: 200rpx;
				}

				.text {
					color: rgb(81, 214, 206);
					font-size: 26rpx;
				}

				.button {
					margin-top: 20rpx;
					display: inline-block;
					padding: 10rpx 20rpx;
					border-radius: 30rpx;
					color: rgb(81, 214, 206);
					border: 2rpx solid rgb(81, 214, 206);
				}
			}

			.r {
				width: 50%;
				display: flex;
				flex-direction: column;
				justify-content: space-around;


			}
		}

		.warn-main {
			padding: 0 20rpx;

			.info {
				background-color: #fef8fd;
				text-align: center;
				padding: 15rpx;
				border-radius: 10rpx;
				margin-bottom: 5rpx;
				font-weight: 600;
			}

			.warn-item {
				background-color: #fff;
				border-radius: 10rpx;
				margin-bottom: 20rpx;
				padding: 20rpx;
				box-shadow: 0 2rpx 10rpx #c3c3c3;

				.module {
					display: flex;
					margin: 5rpx 0;

					text {
						margin-left: 10rpx;
					}
				}

				.title {
					display: flex;
					justify-content: space-between;

					.left {
						display: flex;
						align-items: center;

						&::before {
							content: "";
							display: inline-block;
							width: 8rpx;
							height: 8rpx;
							background-color: #5990FF;
							margin-right: 10rpx;
						}
					}

					.right {
						display: flex;

						view:nth-child(1) {
							margin-right: 10rpx;
						}
					}
				}

				.content {
					margin: 10rpx 0;
					font-size: 28rpx;
				}
			}
		}
	}
</style>